/**
 * Created by zhangqingxi on 2017-04-01.
 */

$(function () {


    deptLoadSuccess();
    initFrequency();
    initProject();

   // resetCombobox('#deviceId',true);
    initControlLevel();
    initMonitoringPointType();
    initMonitoringPointPlace();
    initEmissionLaw();
    initContaminantsType();
    initEffectiveState();

    loadDetailsPointAndProjectList();

});
function  loadDetailsPointAndProjectList() {

    var pointId='';
    var $pointId=$('#pointId');
    if($pointId.length>0){
        pointId=$pointId.val();
    }
    $('#monitorProjectList').datagrid({
        url:findProjectByPointId+pointId,
        fitColumns:true,
        rownumbers:true,
        singleSelect:true,
        sortOrder:true,
        striped:true,
        fit:true,
        columns:[[

            {field:'monitorProjectId',title:'监测点项目',width:10,
                editor:{
                    type:'combobox',
                    options: {
                        required: true,
                        editable: false,
                        valueField:'id',
                        textField:'text',
                        data:projectData,
                        prompt:'请选择'
                    }
                },
                formatter:projectFormatter
            },
            {field:'frequency',title:'分析频次',width:10,
                editor:{
                    type:'combobox',
                    options: {
                        required: true,
                        editable: false,
                        valueField:'id',
                        textField:'text',
                        data:frequencyData,
                        panelHeight:'auto',
                        prompt:'请选择'
                    }
                },
                formatter:frequencyFormatter
            },
            {field:'standardValueUpper',title:'标准值上限',width:10,
                editor:{
                    type:'numberspinner',
                    options: {
                        required: true,
                        precision:2,
                        min:0
                    }
                }
            },
            {field:'standardValueLower',title:'标准值下限',width:10,
                editor:{
                    type:'numberspinner',
                    options: {
                        required: true,
                        precision:2,
                        min:0
                    }
                }
            },
            {field:'unitOfMeasurement',title:'计量单位',width:10,
                editor:{
                    type:'text',
                    options: {
                        required: true
                    }
                }
            }
        ]],
        toolbar: '#monitorProjectToolbar'

    });


}
